package com.laiqilin.controller;

import com.laiqilin.entity.Student;
import com.laiqilin.service.StudentService;
import com.laiqilin.util.PageResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/student")
@CrossOrigin            //跨域
public class StudentController {

	@Autowired
	private StudentService studentService;
	//学生列表
	@GetMapping("/list")
	public List<Student> list(){
		return studentService.findAll();
	}

	//分页查询
	@GetMapping("/findByPage")
	public PageResult<Student> findByPage(@RequestParam("page") Integer page, @RequestParam("pageSize") Integer pageSize) {
		//分页结果
		PageResult<Student> result = studentService.findByPage(page, pageSize);
		return result;
	}

}
